home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: April 23, 1997
- // Author: sjt
- //
- // Description:
- // The extendCurvePreset() procedure executes a extend curve operation on
- // a curve based on the extend option vars.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
-
- proc string pieceTogetherExtendCurveCmd(
- int $cos,
- int $history,
- int $method,
- int $extendType,
- float $distance,
- float $toPointX,
- float $toPointY,
- float $toPointZ,
- int $start,
- int $join,
- int $removeMultKnots,
- int $replaceOriginal )
- //
- // Description :
- // Piece together a extendCurve command.
- //
- {
- string $cmd;
- $cmd = "extendCurve -cos " + $cos;
-
- // construction history
- $cmd = $cmd + " -ch " + $history;
-
- // extend method
- //
- if( $method == 0 ) {
- $cmd = $cmd + " -em 0";
- $cmd = $cmd + " -et " + $extendType;
- $cmd = $cmd + " -d " + $distance;
- }
- else {
- $cmd = $cmd + " -em 2";
- $cmd = $cmd + " -px " + $toPointX;
- $cmd = $cmd + " -py " + $toPointY;
- $cmd = $cmd + " -pz " + $toPointZ;
- }
-
- $cmd = $cmd + " -s " + $start;
-
- // join, removeMultKnots, replaceOriginal
- //
- if( $join == 0 ) {
- // when join is off, removeMultKnots & replace original cannot be done
- $cmd = $cmd + " -jn false -rmk false -rpo false";
- }
- else {
- $cmd = $cmd + " -jn true";
- if ( $removeMultKnots == 1 ) $cmd = $cmd + " -rmk true";
- else $cmd = $cmd + " -rmk false";
- if ( $replaceOriginal == 1 ) $cmd = $cmd + " -rpo on";
- else $cmd = $cmd + " -rpo off";
- }
-
- $cmd += " %s ";
-
- return $cmd;
-
- }
-
- global proc extendCurvePresetArgList(
- string $version,
- string $args[] )
- //
- // ExtendCurve with the preset options.
- // Use this proc when operation dragged to Shelf.
- //
- {
- int $cos, $history, $method, $extendType;
- float $distance, $toPointX, $toPointY, $toPointZ;
- int $start, $join, $removeMultKnots, $replaceOriginal;
-
- // Depending on the version, the argument lists are different.
- // Version 1 of this procedure had 11 args only.
- // Versions after 1 have 12 args, where the first arg is for COS capability
- //
- if( $version == "1") {
- $cos = 0;
- $history = $args[0];
- $method = $args[1];
- $extendType = $args[2];
- $distance = $args[3];
- $toPointX = $args[4];
- $toPointY = $args[5];
- $toPointZ = $args[6];
- $start = $args[7];
- $join = $args[8];
- $removeMultKnots = $args[9];
- $replaceOriginal = $args[10];
- } else {
- $cos = $args[0];
- $history = $args[1];
- $method = $args[2];
- $extendType = $args[3];
- $distance = $args[4];
- $toPointX = $args[5];
- $toPointY = $args[6];
- $toPointZ = $args[7];
- $start = $args[8];
- $join = $args[9];
- $removeMultKnots = $args[10];
- $replaceOriginal = $args[11];
- }
-
- string $cmd = pieceTogetherExtendCurveCmd( $cos, $history, $method, $extendType, $distance, $toPointX, $toPointY, $toPointZ, $start, $join, $removeMultKnots, $replaceOriginal );
-
- // Get the list of nurbs curves selected.
- //
- global int $gSelectNurbsCurvesBit;
- global int $gSelectCurvesOnSurfacesBit;
- global int $gSelectCurveParmPointsBit;
- string $curveList[];
-
- if( $cos ) {
- $curveList = `filterExpand -ex true -sm $gSelectCurvesOnSurfacesBit`;
- }
- else {
- $curveList = `filterExpand -ex true -sm $gSelectNurbsCurvesBit -sm $gSelectCurvesOnSurfacesBit`;
- }
-
- int $numCurves = size($curveList);
- if ( $numCurves == 0 )
- {
- error("No curves selected to extend.");
- }
- else
- {
- string $extendResults[] = executeForEachObject( $curveList, $cmd );
-
- // select the results.
- //
- int $resultCount = size($extendResults);
- if ( $resultCount > 0 )
- {
- string $selectString;
- $selectString = "select ";
- int $i;
- for ( $i = 0; $i < $resultCount; $i++ ) {
- $selectString += $extendResults[$i];
- $selectString += " ";
- }
- $selectString += ";";
- select -cl;
- eval($selectString);
- }
- }
- }
-